#include <fstream>

template< typename T, unsigned int N >
bool VectorRead( Vector<T,N>* verts, ifstream& file ) {
  T temp;

  unsigned int i = 0;
  while( !file.eof() ) {
    for( unsigned int j = 0; j < N; ++j ) {
      if( file.bad() )
        return false;
      file >> temp;
      verts[i][j] = temp;
    }
    ++i;
  }
  return true;
}

template< typename T, unsigned int N >
Vector<T,N>* ReadInVector( const char* fileName, unsigned int& count ) {
  count = 0;

  std::ifstream file( fileName );
  std::cout << fileName << " opened!" << std::endl;

  if( file.is_open() ) {
    unsigned int vertCount;
    file >> vertCount;

    Vector<T,N>* newVector = new Vector<T,N>[vertCount/N];
    
    VectorRead( newVector, file );

    file.close();
    std::cout << fileName << " closed!" << std::endl;

    count = vertCount/N;
    return newVector;
  }

  return NULL;
}

